<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fns" uri="http://java.sun.com/jsp/jstl/functionss" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Home - BioCode</title>

</head>
<body>
<div id="main">
    <div class="content-container">
        <div class="row">
            <div class="col-md-3">
                <div class="bio well"><h3 class="fullname">${user.fullName}</h3>
                    <p><i class="fa fa-envelope-o"></i> Email: ${user.email}</p>
                    <p><i class="fa fa-code"></i> Contributed Tools: ${fn:length(credits)}</p>
                    <p><i class="fa fa-university"></i> Organization:<br>${user.organization}</p></div>
            </div>
            <div class="col-md-9">
                <div class="panel panel-success">
                    <div class="panel-heading">
                        <div class="panel-title"><strong><i class="fa fa-code"></i> Contributed Tools</strong></div>
                    </div>
                    <table class="table table-hover table-striped">
                        <thead>
                        <tr>
                            <th width="30%">Tool Name</th>
                            <th width="30%">Contribute As</th>
                            <th width="20%">Latest Release</th>
                            <th>Download Count</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="c" items="${credits}">
                        <tr>
                            <td><a href="${host}/tools/${c.tool.id}/show">${c.tool.name}</a></td>


                            <td>
                            <c:forEach var="item" items="${c.creditRoleList}">
                                <span class="<c:if test="${item.id==1}">label role label-primary</c:if><c:if test="${item.id==2}">label role label-info</c:if><c:if test="${item.id==3}">label role label-default</c:if>"><i class="fa fa-user-circle-o"></i>${item.name}</span>
                            </c:forEach>
                            </td>
                            <td>
                                <c:set var="releases" value="${c.tool.releases}"></c:set>
                                    ${releases[0].version}
                            </td>
                            <td>${fns:calReleaseDownloadCount(releases[0].id)}</td>
                        </tr>
                        </c:forEach>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script>

</script>
</body>
</html>
